/*
 * VertexComparator.java
 *
 * Created on 2007年10月12日, 下午4:11
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
package com.exclamation.util.graph;

import java.util.Comparator;

/**
 *
 * @author littlerock
 */
public class VertexComparator implements Comparator<Vertex> {

    private static VertexComparator instance;

    public static Comparator<Vertex> getVertexComparator() {
        if (instance == null) {
            instance = new VertexComparator();
        }
        return instance;
    }

    public int compare(Vertex v1, Vertex v2) {
        if (v1.getId() == v2.getId()) {
            return 0;
        } else if (v1.getId() < v2.getId()) {
            return -1;
        } else {
            return 1;
        }
    }

    public boolean equals(Object o) {
        return false;
    }
}